local heg_description = [==[
# 单将国战简介

只选一个武将的国战，其他不变。

]==]

local H = require "packages/klxf/util"

local heg

---@class kl__HegLogic: GameLogic
local kl__HegLogic = {}

function kl__HegLogic:assignRoles()
  local room = self.room
  for _, p in ipairs(room.players) do
    room:setPlayerProperty(p, "role_shown", false)
    p.role = "hidden"
    room:broadcastProperty(p, "role")
  end

  -- for adjustSeats
  room.players[1].role = "lord"
end

function kl__HegLogic:chooseGenerals()
  local room = self.room
  local generalNum = math.max(room.settings.generalNum, 1)
  room:doBroadcastNotify("ShowToast", Fk:translate("#kl__HegInitialNotice"))

  local lord = room:getLord()
  room:setCurrent(lord)
  lord.role = "hidden"

  local players = room.players
  local generals = room:getNGenerals(#players * generalNum) -- Fk:getGeneralsRandomly
  table.shuffle(generals)
  local req = Request:new(players, "AskForGeneral")
  for k, p in ipairs(players) do
    local arg = table.slice(generals, (k - 1) * generalNum + 1, k * generalNum + 1)
    -- table.sort(arg, function(a, b) return Fk.generals[a].kingdom > Fk.generals[b].kingdom end)--按武将的势力对分配的武将进行排序。
    req:setData(p, { arg, 1 }) -- 修改为只选择 1 张武将牌
    req:setDefaultReply(p, table.random(arg, 1))
  end

  local selected = {}
  for _, p in ipairs(players) do
    local general_ret = req:getResult(p)
    local general = general_ret[1]
    room:setPlayerGeneral(p, general, true) --将玩家选择的武将设置为其主将，并明置。
    table.insert(selected, general)

    room:setPlayerMark(p, "__heg_general", general)

    room:setPlayerGeneral(p, "anjiang", true) -- 暗置武将
  end

  generals = table.filter(generals, function(g) return not table.contains(selected, g) end)
  room:returnToGeneralPile(generals)

  local allKingdoms = {}
  table.forEach(room.general_pile, function(name) table.insertIfNeed(allKingdoms, Fk.generals[name].kingdom) end)
  table.removeOne(allKingdoms, "wild")
  table.sort(allKingdoms)

  -- req = Request:new(players, "AskForChoice")
  -- req.focus_text = "AskForKingdom"
  -- req.receive_decode = false

  -- for _, p in ipairs(players) do
  --   local curGeneral = Fk.generals[p:getMark("__heg_general")]
  --   local kingdoms = { curGeneral.kingdom, curGeneral.subkingdom }
  --   if kingdoms[1] == "wild" then
  --     kingdoms = { curGeneral.kingdom, curGeneral.subkingdom }
  --     room:setPlayerMark(p, "__heg_wild", 1)
  --   else
  --     kingdoms = table.filter(kingdoms, function(k) return curGeneral.kingdom == k or curGeneral.subkingdom == k end)
  --   end

  --   req:setData(p, { kingdoms, allKingdoms, "AskForKingdom", "#ChooseHegInitialKingdom" })
  --   req:setDefaultReply(p, kingdoms[1])
  -- end

  -- for _, p in ipairs(players) do
  --   local kingdomChosen = req:getResult(p)
  --   room:setPlayerMark(p, "__heg_kingdom", kingdomChosen)      -- 变野后变为wild
  --   room:setPlayerMark(p, "__heg_init_kingdom", kingdomChosen) -- 保存初始势力
  --   p.default_reply = ""
  -- end
  for _, p in ipairs(players) do
    local curGeneral = Fk.generals[p:getMark("__heg_general")]
    local kingdoms = { curGeneral.kingdom, curGeneral.subkingdom }
    if kingdoms[1] == "wild" then
      kingdoms = { curGeneral.kingdom, curGeneral.subkingdom }
      room:setPlayerMark(p, "__heg_wild", 1)
    else
      kingdoms = table.filter(kingdoms, function(k) return curGeneral.kingdom == k or curGeneral.subkingdom == k end)
    end

    room:setPlayerMark(p, "__heg_kingdom", kingdoms[1])
    room:setPlayerMark(p, "__heg_init_kingdom", kingdoms[1])
  end
end

function kl__HegLogic:broadcastGeneral()
  local room = self.room
  local players = room.players

  for _, p in ipairs(players) do
    assert(p.general ~= "")
    local general = Fk.generals[p:getMark("__heg_general")]
    local maxHp = general.maxHp
    p.maxHp = maxHp
    p.hp = p.maxHp
    p.shield = 0

    room:broadcastProperty(p, "general")
    room:broadcastProperty(p, "maxHp")
    room:broadcastProperty(p, "hp")
    room:broadcastProperty(p, "shield")

    p.role = p:getMark("__heg_wild") == 1 and "wild" or p:getMark("__heg_kingdom")
  end
end

function kl__HegLogic:prepareDrawPile()
  GameLogic.prepareDrawPile(self)

  local room = self.room
  for _, cid in ipairs(room.draw_pile) do
    local card = Fk:getCardById(cid)
    if table.contains(H.allianceCards, card) then
      room:setCardMark(card, "@@alliance", 1)
    end
  end
  for _, cid in ipairs(room.void) do
    local card = Fk:getCardById(cid)
    if table.contains(H.allianceCards, card) then
      room:setCardMark(card, "@@alliance", 1)
    end
  end
end

local function addHegSkill(player, skill, room)
  if skill.frequency == Skill.Compulsory then
    player:addFakeSkill("reveal_skill&")
  end
  player:addFakeSkill(skill)
  local toget = { table.unpack(skill.related_skills) }
  table.insert(toget, skill)
  for _, s in ipairs(toget) do
    if s:isInstanceOf(TriggerSkill) then
      room.logic:addTriggerSkill(s)
    end
  end
end

function kl__HegLogic:attachSkillToPlayers()
  local room = self.room
  local players = room.players

  room:handleAddLoseSkills(players[1], "#_heg_invalid", nil, false, true)

  for _, p in ipairs(room.alive_players) do
    -- UI
    p:setMark("@seat", "seat#" .. tostring(p.seat))
    p:doNotify("SetPlayerMark", json.encode { p.id, "@seat", "seat#" .. tostring(p.seat) })

    local general = Fk.generals[p:getMark("__heg_general")]
    local skills = table.connect(general.skills, table.map(general.other_skills, Util.Name2SkillMapper))
    for _, s in ipairs(skills) do
      if s.relate_to_place ~= "d" then --bug
        addHegSkill(p, s, room)
      end
    end

    -- local deputy = Fk.generals[p:getMark("__heg_deputy")]
    -- if deputy then
    --   skills = table.connect(deputy.skills, table.map(deputy.other_skills, Util.Name2SkillMapper))
    --   for _, s in ipairs(skills) do
    --     if s.relate_to_place ~= "m" then
    --       addHegSkill(p, s, room)
    --     end
    --   end
    -- end
  end

  room:setTag("SkipNormalDeathProcess", true)
  room:doBroadcastNotify("ShowToast", Fk:translate("#kl__HegInitialNotice"))
end

local heg_getlogic = function()
  local h = GameLogic:subclass("kl__HegLogic")
  for k, v in pairs(kl__HegLogic) do
    h[k] = v
  end
  return h
end

local heg_invalid = fk.CreateInvaliditySkill {
  name = "#_heg_invalid",
  invalidity_func = function(self, player, skill)
  end,
}

local wildKingdoms = { "heg_qin", "heg_qi", "heg_chu", "heg_yan", "heg_zhao", "heg_hanr", "heg_jin", "heg_han", "heg_xia",
  "heg_shang", "heg_zhou", "heg_liang" } -- hanr 韩
local kingdomMapper = {
  ["ld__zhonghui"] = "heg_han",
  ["ld__simazhao"] = "heg_jin",
  ["ld__gongsunyuan"] = "heg_yan",
  ["ld__sunchen"] = "heg_chu"
}

--- 野心家选择国家
---@param room Room
---@param player ServerPlayer
---@param generalName string
local function wildChooseKingdom(room, player, generalName)
  local choice
  local all_choices = table.clone(wildKingdoms)
  local choices = table.clone(all_choices)
  for _, p in ipairs(room.players) do
    table.removeOne(choices, p.role)
  end
  if player.general == generalName and kingdomMapper[generalName] and kingdomMapper[generalName] ~= player.role then -- 野心家钦定
    if table.contains(choices, kingdomMapper[generalName]) then
      choice = kingdomMapper[generalName]
    else
      choice = room:askForChoice(player, choices, "#kl_heg_rule", "#wild-choose", false, all_choices)
    end
  elseif table.contains({ "wei", "shu", "wu", "qun", "jin", "unknown", "hidden" }, player.role) then
    choice = room:askForChoice(player, choices, "#kl_heg_rule", "#wild-choose", false, all_choices)
  end
  if choice then
    player.role = choice
    room:setPlayerProperty(player, "role_shown", true)
    room:broadcastProperty(player, "role")
    room:sendLog {
      type = "#WildChooseKingdom",
      from = player.id,
      arg = choice,
      arg2 = "wild",
    }
  end
end

--- 询问加入建国
---@param room Room
---@param player ServerPlayer
---@param generalName string
---@param isActive boolean
---@return boolean
local function AskForBuildCountry(room, player, generalName, isActive)
  if not (player.general == generalName and kingdomMapper[generalName]) then return false end
  local choices = { "kl_heg_rule_join_country:" .. player.id .. "::" .. player.role, "Cancel" }
  local targets = table.map(room.alive_players, Util.IdMapper)
  room:sortPlayersByAction(targets)
  for _, pid in ipairs(targets) do
    local p = room:getPlayerById(pid)
    if p:getMark("__heg_join_wild") == 0 and p.kingdom ~= "wild" and not string.find(p.general, "lord")
        and (not isActive or p.general ~= "anjiang") then
      local choice = room:askForChoice(p, choices, "#kl_heg_rule", "#wild_join-choose")
      if choice ~= "Cancel" then
        p.role = player.role
        room:setPlayerProperty(p, "role_shown", true)
        room:broadcastProperty(p, "role")
        room:sendLog {
          type = "#WildChooseKingdom",
          from = p.id,
          arg = player.role,
          arg2 = "wild",
        }
        room:setPlayerProperty(p, "kingdom", "wild")
        room:setPlayerMark(p, "__heg_join_wild", 1)
        room:setPlayerMark(player, "__heg_construct_wild", 1)
        room:sendLog {
          type = "#SuccessBuildCountry",
          from = player.id,
          arg = player.role,
          arg2 = p.general
        }
        if p:isWounded() then
          room:recover({
            who = p,
            num = 1,
            recoverBy = player,
            skillName = "#kl_heg_rule",
          })
        end
        if p:getHandcardNum() < 4 then
          p:drawCards(4 - p:getHandcardNum(), "#kl_heg_rule")
        end
        return true
      end
    end
  end
  return false
end

local kl_heg_rule = fk.CreateTriggerSkill {
  name = "#kl_heg_rule",
  priority = 0.001,
  events = { fk.BeforeTurnStart, fk.TurnStart, fk.GameOverJudge, fk.Deathed, fk.GeneralRevealed, fk.EventPhaseChanging, fk.GeneralShown, fk.GameStart },
  can_trigger = function(self, event, target, player, data)
    return target == player
  end,
  on_trigger = function(self, event, target, player, data)
    local room = player.room
    if event == fk.BeforeTurnStart then
      -- 鏖战
      if #room.alive_players < (#room.players > 6 and 5 or 4) and not room:getTag("BattleRoyalMode") then
        local ret = true
        for _, v in pairs(H.getKingdomPlayersNum(room)) do
          if v and v > 1 then
            ret = false
            break
          end
        end
        if ret then
          room:doBroadcastNotify("ShowToast", Fk:translate("#EnterBattleRoyalMode"))
          room:sendLog {
            type = "#EnterBattleRoyalModeLog",
          }
          room:setTag("BattleRoyalMode", true)
          room:setBanner("@[:]BattleRoyalDummy", "BattleRoyalMode")
          for _, p in ipairs(room.alive_players) do
            -- p:addFakeSkill("battle_royal&")
            -- p:addFakeSkill("battle_royal_prohibit&")
            room:handleAddLoseSkills(p, "battle_royal&", nil, false, true)
          end
        end
      end
    elseif event == fk.TurnStart then
      H.askForRevealGenerals(room, player, self.name, true, true, true, true, true) -- lord
    elseif event == fk.GameOverJudge then                                           --删除建国
      -- if table.every(room.alive_players, function (p) return H.compareKingdomWith(p, player) end) then
      player:revealGeneral(false)
      player:revealGeneral(true)
      if player.kingdom == "wild" then
        wildChooseKingdom(room, player, player.general)
      end
      local winner = Fk.game_modes[room.settings.gameMode]:getWinner(player)
      if winner ~= "" then
        for _, ps in ipairs(room.alive_players) do
          -- 先检测并询问主将是不是野人
          if ps.general == "anjiang" then
            -- 是野人则强制亮出来
            if ps:getMark("__heg_wild") == 1 then
              room:setPlayerMark(ps, "_wild_final_end", 1)
              ps:revealGeneral(false)
            end
          end
        end
        -- 强制亮完野人后检测场上有没有野人
        if table.find(room.alive_players, function(p) return p:getMark("__heg_wild") == 1 end) then
          --有野人则依次询问拉拢
          for _, p in ipairs(room.alive_players) do
            if p:getMark("__heg_wild") == 1 then
              wildChooseKingdom(room, p, p.general)
              AskForBuildCountry(room, p, p.general, false)
              room:setPlayerMark(p, "_wild_gained", 1)
            end
          end
        end
        -- 然后判断场上所有人势力是否相同
        local _kingdom2 = {}
        for _, p in ipairs(room.alive_players) do
          if not table.contains(_kingdom2, p.kingdom) then
            table.insert(_kingdom2, p.kingdom)
          end
        end
        if #_kingdom2 == 1 then
          -- 若所有人势力相同则全部亮将
          for _, p in ipairs(room.alive_players) do
            if p.general == "anjiang" then p:revealGeneral(false) end
            if p.deputyGeneral == "anjiang" then p:revealGeneral(true) end
          end
          room:gameOver(winner)
          return true
        end
      end
      room:setTag("SkipGameRule", true)
    elseif event == fk.Deathed then
      local damage = data.damage
      if damage and damage.from then
        local killer = damage.from
        if killer.kingdom ~= "unknown" and not killer.dead then
          -- 因为建国，修改奖惩；如果还没建国
          if killer.kingdom == "wild" and killer:getMark("__heg_construct_wild") == 0 and killer:getMark("__heg_join_wild") == 0 then
            killer:drawCards(3, "kill")
          elseif H.compareKingdomWith(killer, player) then
            if not (room.logic:getCurrentEvent():findParent(GameEvent.Death, true).data[1].extra_data or {}).ignorePunishment then
              killer:throwAllCards("he")
            end
          else
            killer:drawCards(H.getSameKingdomPlayersNum(room, player) + 1, "kill")
          end
        end
      end
      if string.find(player.general, "lord") then
        local players = table.map(table.filter(room.players, function(p)
          return
              (p:getMark("__heg_kingdom") == player.kingdom or (p.dead and p.kingdom == player.kingdom)) and p ~= player and
              p.kingdom ~= "wild"
        end), Util.IdMapper)
        room:sortPlayersByAction(players)
        for _, pid in ipairs(players) do
          local p = room:getPlayerById(pid)
          local oldKingdom = p.kingdom
          room:setPlayerMark(p, "__heg_kingdom", "wild")
          if oldKingdom ~= "unknown" then
            room:setPlayerProperty(p, "kingdom", "wild")
            if not p.dead then wildChooseKingdom(room, p, p.general) end
          end
        end
      end
    elseif event == fk.GeneralRevealed then
      for _, general_name in pairs(data) do
        if room:getTag("TheFirstToShowRewarded") == player.id and player:getMark("_vanguard_gained") == 0 then
          room:setPlayerMark(player, "_vanguard_gained", 1)
          H.addHegMark(room, player, "vanguard")
        end
        if player:getMark("hasShownMainGeneral") == 1 and Fk.generals[general_name].kingdom == "wild" and player:getMark("_wild_gained") == 0 then
          room:setPlayerMark(player, "_wild_gained", 1)
          H.addHegMark(room, player, "wild")
        end
        if player.general == "anjiang" or player.deputyGeneral == "anjiang" then return false end
        if player:getMark("HalfMaxHpLeft") > 0 then
          room:setPlayerMark(player, "HalfMaxHpLeft", 0)
          H.addHegMark(room, player, "yinyangfish")
        end
        if player:getMark("CompanionEffect") > 0 then
          room:setPlayerMark(player, "CompanionEffect", 0)
          H.addHegMark(room, player, "companion")
        end
      end
    elseif event == fk.EventPhaseChanging then
      if data.to == Player.Play then
        player:addFakeSkill("alliance&")
        --bug：
        -- 04/17 00:32:26 Main[W] file:///D:/FreeKill-v0.5.4/FreeKill-release/Fk/Common/AvatarChatBox.qml:78:11: QML QQuickText: Binding loop detected for property "width"
        -- 04/17 00:32:43 Room[C] ./lua/server\serverplayer.lua:639: attempt to index a nil value (local 'skill')
        -- stack traceback:
        -- ./lua/server\serverplayer.lua:639: in method 'addFakeSkill'
        -- ./packages\klxf\kl__hegemony.lua:428: in method 'trigger'
        -- ./lua/server\gamelogic.lua:411: in method 'trigger'
        -- ./lua/server\serverplayer.lua:331: in method 'play'
        -- ./lua/server\events\gameflow.lua:228: in function <./lua/server\events\gameflow.lua:219>
        -- (...tail calls...)
      elseif data.from == Player.Play then
        player:loseFakeSkill("alliance&")
      end
    elseif event == fk.GeneralShown then
      if not room:getTag("TheFirstToShowRewarded") then
        room:setTag("TheFirstToShowRewarded", player.id)
      end
      local general_name = data["m"] or data["d"]
      -- 君主拉回野人
      if general_name and string.find(general_name, "lord") then
        local kingdom = player:getMark("__heg_kingdom")
        for _, p in ipairs(room.players) do
          if p:getMark("__heg_kingdom") == kingdom and p.kingdom == "wild" and p:getMark("__heg_wild") == 0 then
            room:setPlayerProperty(p, "kingdom", kingdom)
            room:setPlayerProperty(p, "role_shown", false)
            room:setPlayerProperty(p, "role", kingdom)
          end
        end
      end
      if player.kingdom == "wild" and not player.dead and player:getMark("_wild_gained") == 0 then
        wildChooseKingdom(room, player, general_name)
        -- 野人亮出来的时候询问拉拢
        local choices = { "Cancel" }
        if player:getMark("__heg_wild") == 1 and player:getMark("_wild_final_end") == 0 then
          table.insert(choices, "heg_build_country:::" .. player.role)
        end
        -- if room:askForChoice(player, choices, "#kl_heg_rule") ~= "Cancel" then
        --   AskForBuildCountry(room, player, general_name, true)
        --   room:setPlayerMark(player, "_wild_gained", 1)
        -- end
      elseif player:getMark("__heg_join_wild") == 0 and player:getMark("__heg_construct_wild") == 0 then
        if player:getMark("__heg_wild") == 1 then
          player.role = player.kingdom
        else
          room:setPlayerProperty(player, "role", player.kingdom)
        end
      end

      for _, v in pairs(H.getKingdomPlayersNum(room)) do
        if v == #room.alive_players then
          local winner = Fk.game_modes[room.settings.gameMode]:getWinner(player)
          for _, p in ipairs(room.alive_players) do
            -- 先检测并询问主将是不是野人
            if p.general == "anjiang" then
              -- 是野人则强制亮出来
              if p:getMark("__heg_wild") == 1 then
                room:setPlayerMark(p, "_wild_final_end", 1)
                p:revealGeneral(false)
              end
            end
          end
          -- 强制亮完野人后检测场上有没有野人
          if table.find(room.alive_players, function(p) return p:getMark("__heg_wild") == 1 end) then
            --有野人则依次询问拉拢
            for _, p in ipairs(room.alive_players) do
              if p:getMark("__heg_wild") == 1 then
                wildChooseKingdom(room, p, p.general)
                AskForBuildCountry(room, p, p.general, false)
                room:setPlayerMark(p, "_wild_gained", 1)
              end
            end
          end
          -- 然后判断场上所有人势力是否相同
          if table.every(room.alive_players, function(p) return H.compareKingdomWith(p, player) end) then
            -- 若所有人势力相同则全部亮将
            for _, p in ipairs(room.alive_players) do
              if p.general == "anjiang" then p:revealGeneral(false) end
              if p.deputyGeneral == "anjiang" then p:revealGeneral(true) end
            end
            room:gameOver(winner)
            return true
          end
        else
          break
        end
      end
      if player:getMark("hasShownMainGeneral") == 0 and data["m"] then -- 首次亮主将
        room:setPlayerMark(player, "hasShownMainGeneral", 1)
      end
    elseif event == fk.GameStart then
      for _, p in ipairs(room.players) do
        p:setMark("@seat", 0)
        p:doNotify("SetPlayerMark", json.encode { p.id, "@seat", 0 })
      end
    end
  end,
}
Fk:addSkill(kl_heg_rule)

heg = fk.CreateGameMode {
  name = "kl_heg_mode",
  minPlayer = 2,
  maxPlayer = 10,
  rule = kl_heg_rule,
  logic = heg_getlogic,
  is_counted = function(self, room)
    return #room.players >= 6
  end,
  whitelist = {
    "wei",
    "shu",
    "wu",
    "qun",

    "kl__hegemony_cards"
  },
  winner_getter = function(self, victim)
    local room = victim.room
    local alive = table.filter(room.alive_players, function(p)
      return not p.surrendered
    end)
    if #alive == 1 then
      local p = alive[1] ---@type ServerPlayer
      p:revealGeneral(false)
      p:revealGeneral(true)
      return p.role
    end

    local winner -- = alive[1]
    for _, p in ipairs(alive) do
      if p.kingdom ~= "unknown" then
        winner = p
        break
      end
    end
    if not winner then return "" end
    local kingdom = H.getKingdom(winner)
    local i = H.getKingdomPlayersNum(room, true)[kingdom]
    for _, p in ipairs(alive) do
      if not H.compareExpectedKingdomWith(p, winner) then
        return ""
      end
      if p.kingdom == "unknown" then
        i = i + 1
      end
    end
    if i > #room.players // 2 and not H.getHegLord(room, winner) then return "" end
    return kingdom
  end,
  surrender_func = function(self, playedTime)
    local winner
    local kingdomCheck = true
    for _, p in ipairs(Fk:currentRoom().alive_players) do
      -- 场上有未明置的主将时不能投降
      if p.general == "anjiang" then
        kingdomCheck = false
        break
      end
      if p ~= Self then
        if not winner then
          winner = p
        elseif not H.compareKingdomWith(winner, p) then
          kingdomCheck = false
          break
        end
      end
    end
    return { { text = "heg: besieged on all sides", passed = kingdomCheck } }
  end,

  build_draw_pile = function(self)
    local draw, void = GameMode.buildDrawPile(self)
    for i = #draw, 1, -1 do
      local card = Fk:getCardById(draw[i])
      if H.convertCards[card.name] and table.find(H.convertCards[card.name], function(c)
            return table.contains(draw, c.id)
          end) then
        local id = draw[i]
        table.remove(draw, i)
        table.insert(void, id)
      end
    end
    return draw, void
  end
}

Fk:loadTranslationTable {
  ["kl_heg_mode"] = "单将国战",
  [":kl_heg_mode"] = heg_description,
  ["#ChooseHegInitialKingdom"] = "国战规则：选择你的初始势力",
  ["wild"] = "野心家",
  ["#kl_heg_rule"] = "单将国战规则",
  ["revealAll"] = "全部明置",
  ["#EnterBattleRoyalMode"] = "游戏进入 <font color=\"red\"><b>鏖战模式</b></font>，所有的【<font color=\"#3598E8\"><b>桃</b></font>】" ..
      "只能当【<font color=\"#3598E8\"><b>杀</b></font>】或【<font color=\"#3598E8\"><b>闪</b></font>】使用或打出，不能用于回复体力",
  ["#EnterBattleRoyalModeLog"] = "游戏进入 <font color=\"#CC3131\"><b>鏖战模式</b></font>",
  ["@[:]BattleRoyalDummy"] = "", -- 额
  ["BattleRoyalMode"] = "鏖战模式",
  [":BattleRoyalMode"] = "所有的【<font color=\"#3598E8\"><b>桃</b></font>】" ..
      "只能当【<font color=\"#3598E8\"><b>杀</b></font>】或【<font color=\"#3598E8\"><b>闪</b></font>】使用或打出，不能用于回复体力",
  ["#wild-choose"] = "野心家建国：选择你要成为的势力！",
  ["heg_qin"] = "秦",
  ["heg_qi"] = "齐",
  ["heg_chu"] = "楚",
  ["heg_yan"] = "燕",
  ["heg_zhao"] = "赵",
  ["heg_hanr"] = "韩",
  ["heg_jin"] = "晋",
  ["heg_han"] = "汉",
  ["heg_xia"] = "夏",
  ["heg_shang"] = "商",
  ["heg_zhou"] = "周",
  ["heg_liang"] = "凉",
  ["#WildChooseKingdom"] = "%from 成为 %arg2 ，选择了势力 %arg",
  ["heg: besieged on all sides"] = "四面楚歌，被同一势力围观",
  ["@@alliance"] = "合",
  ["@@alliance-inhand"] = "合",
  ["@@alliance-inhand-turn"] = "合",
  ["@seat"] = "",
  ["stack"] = "叠置",

  ["#SuccessBuildCountry"] = "%from 成功建立国家，国号 %arg ，队友是 %arg2",
  ["kl_heg_rule_join_country"] = "加入 <b><font color='purple'>%src</font></b> 的阵营 <b><font color='purple'>%arg</font></b>，回复1点体力，将手牌摸至4张",
  ["heg_build_country"] = "拉拢人心，询问其他角色加入 <b><font color='purple'>%arg</font></b>",

  ["#kl__HegInitialNotice"] = "提示：此为单将国战，其他规则与19新国战相同",
}

return heg
